// components/bookself/BookItem/BookItem.js
const computedBehavior = require("miniprogram-computed").behavior;
Component({
  /**
   * 组件的属性列表
   */
  behaviors: [computedBehavior],
  options: {
    "styleIsolation": 'apply-shared',
  },
  properties: {
    item:{
      type:Object,
      value:{}
    },
    showRead:{
      type:Boolean,
      value:true
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    surplusPage:0
  },
  computed:{
    url(data){
      let url = "";
      if(data.item?.title){
        url = data.item.link?.filter((item) =>item.type == 'image/png')[0].href
      }
      return url;
    },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    toDetail(){
      wx.navigateTo({
        url: `/pages/detail/detail?id=${this.data.item.id}&title=${this.data.item.title}`,
      });
    }
  },
  lifetimes:{
    ready(){
      console.log(this.data.item);
    },
  }
})
